add_repositories("private-repo https://gitee.com/SmartSmallBoy/private-xmake-repo.git")

add_requires("c_utils", {version = "0.0.1", configs = {shared = is_kind("shared")}})
add_requires("openssl3", {version = "3.3.1", configs = {shared = is_kind("shared")}})

target("sqlite")
	set_kind("$(kind)")
	add_files("src/sqlite3.c")
	add_includedirs("include",{public=true})
	add_headerfiles("include/*.h")
	add_defines(
		"NDEBUG=1",
		"HAVE_USLEEP=1",
		"SQLITE_HAVE_ISNAN",
		"SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576",
		"SQLITE_THREADSAFE=2",
		"SQLITE_TEMP_STORE=3",
		"SQLITE_POWERSAFE_OVERWRITE=1",
		"SQLITE_DEFAULT_FILE_FORMAT=4",
		"SQLITE_DEFAULT_AUTOVACUUM=1",
		"SQLITE_ENABLE_MEMORY_MANAGEMENT=1",
		"SQLITE_ENABLE_FTS3",
		"SQLITE_ENABLE_FTS4",
		"SQLITE_ENABLE_FTS5",
		"SQLITE_OMIT_COMPILEOPTION_DIAGS",
		"SQLITE_DEFAULT_FILE_PERMISSIONS=0660",
		"SQLITE_SECURE_DELETE",
		"SQLITE_ENABLE_BATCH_ATOMIC_WRITE",
		"USE_PREAD64",
		"fdatasync=fdatasync",
		"HAVE_MALLOC_H=1",
		"HAVE_MALLOC_USABLE_SIZE",
		"SQLITE_DIRECT_OVERFLOW_READ",
		"SQLITE_HAS_CODEC",
		"SQLITE_EXPORT_SYMBOLS",
		"SQLITE_SHARED_BLOCK_OPTIMIZATION",
		"SQLITE_CODEC_ATTACH_CHANGED",
		"SQLITE_ENABLE_DROPTABLE_CALLBACK",
		"OPENSSL_SUPPRESS_DEPRECATED",
		"LOG_DUMP",
		-- "FDSAN_ENABLE",
		"HARMONY_OS"
	)
	add_cflags(
		"-fvisibility=hidden",
    	"-Wno-implicit-fallthrough"
	)
	add_ldflags(
		"-Wl,--exclude-libs,ALL"
	)
	add_packages("c_utils", "openssl3")